package com.ux.example
{
	import com.ux.base.BLoader;
	import com.ux.debug.msg;
	import com.ux.debug.viewFonts;
	
	import flash.display.DisplayObjectContainer;
	import flash.display.Sprite;
	import flash.display.StageAlign;
	import flash.display.StageScaleMode;
	import flash.text.Font;
	import flash.text.TextField;
	import flash.text.TextFieldAutoSize;
	import flash.text.TextFormat;
	import flash.utils.getDefinitionByName;
	
	import mx.controls.Text;

	public class FontTest extends Sprite
	{
		private var loader : BLoader;
		private var txt : TextField;
		
		public function FontTest()
		{
			stage.align = StageAlign.TOP_LEFT;
			stage.scaleMode = StageScaleMode.NO_SCALE;
			
			loader = new BLoader( "../assets/font/hy.swf", null, onLoadHandler );
			
			txt = new TextField();
			addChild( txt );
			txt.autoSize = TextFieldAutoSize.LEFT;
			txt.text = "가나다라마바사아자차카타파하";
			
		}
		
		private function onLoadHandler():void 
		{
			Font.registerFont( loader.contentLoaderInfo.applicationDomain.getDefinition( "HYGothicExtra" ) as Class );
			txt.defaultTextFormat = new TextFormat( "HYGothic-Extra", 30 );
			txt.setTextFormat( new TextFormat( "HYGothic-Extra",30 ) );
			txt.embedFonts = true;
			viewFonts();
		}
	}
}


